import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
import vuexPersist from "vuex-persist";

export default new Vuex.Store({
  state: {
    flag: "all",
    goods: [],
  },
  mutations: {
    setdata(state, val) {
      state.goods = val;
    },
    removeall(state, result) {
      state.goods = state.goods.filter((item) => {
        return result.includes(item) == false;
      });
    },
    //选中删除 把不删的留下来 result代表从 组件中传过来的参数 要删除的数据
  },
  actions: {},
  modules: {},
  plugins: [
    new vuexPersist({
      storage: window.localStorage,
    }).plugin,
  ],
});
